//
//  COWalletCellModel.swift
//  CocoProject
//
//  Created by Ruthless on 2023/8/30.
//

import UIKit

class COWalletCellModel: NSObject {
    var isNew = false
    var money: NSAttributedString?
    var total: String = ""
    var off = 100
    
    func change(_ item: COMoneyModel) {
        self.isNew = item.activity > 0
        if item.realPrice == "" {
            self.off = 100
        } else {
            self.off = Int((Double(item.price)!/Double(item.realPrice)!)*100)
        }
        self.money = NSMutableAttributedString.rz.colorfulConfer(confer: { confer in
            if item.freeCoins > 0 {
                confer.text("\(item.realPriceCoins)")?.font(.medium(18)).textColor(.white)
                confer.text("+\(item.freeCoins)")?.font(.medium(18)).textColor(.rgba(255, 153, 48, 1))
            } else {
                confer.text("\(item.priceCoins)")?.font(.medium(18)).textColor(.white)
            }
        })
        self.total = item.price
        
//        self.isNew = false
//        self.off = 80
//        self.money = NSMutableAttributedString.rz.colorfulConfer(confer: { confer in
//            confer.text("111")?.font(.medium(18)).textColor(.white)
//            confer.text("+12")?.font(.medium(18)).textColor(.rgba(255, 153, 48, 1))
//        })
//        self.total = "11.99"
    }
}
